<%@ page contentType="text/html; charset=utf-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>     
    <title>社会保障卡单位换卡登记</title>    
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />	
	<script src="${pageContext.request.contextPath }/scripts/boot.js"
	type="text/javascript"></script>
	<script src="${pageContext.request.contextPath }/scripts/LodopFuncs.js"
	type="text/javascript"></script> 
<style type="text/css">
    html, body{
        margin:0;padding:0;border:0;width:100%;height:100%;overflow:hidden;
    } 
    
    #a {
	position:absolute;
	left:0px;
	top:0px;
	width:52%;
	height:100%;
	z-index:1;
}   

   #b {
	position:absolute;
	left:580px;
	top:10px;
	width:56%;
	height:100%;
	z-index:1;
}    
 </style>
</head> 
 <body onload="makePC()"> 
 <div id="a">
 <fieldset style="border:solid 1px #aaa;padding:3px;">
  <legend >单位换卡登记</legend>
  <form id="form1" method="post">
<div style="padding-left:11px;padding-bottom:5px;" >
  <table style="table-layout:fixed;">
   <tr>
      <td style="white-space:nowrap;width:90px ;text-align:right" >劳动保障证号:</td>
      <td style="width:180px"><input class="mini-textbox" style="width:100%" name="aab001"  onenter="onKeyEnter" required="true" vtype="int;minLength:8" maxlength="8" emptyText="请输入劳动保障证号"/></td>      
      <td style="width:90px ;text-align:right ">制卡批次:</td>
      <td style="width:180px"><input name="aaz001" class="mini-textbox" inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"  style="width:100%"/></td>      
    </tr>
    <tr>
      <td style="width:90px ;text-align:right ">单位名称:</td>
      <td style="width:180px"><input   name="aab004" class="mini-textbox" style="width:100%"  inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"/></td>
      <td style="width:90px ;text-align:right ">银 行:</td>
      <td style="width:180px"><input name="aae008" class="mini-combobox" required="true" style="width:100%"  textField="aaa103" valueField="aaa102" emptyText="请选择..."
      url="${pageContext.request.contextPath }/make.do?method=getyinhang&sj=bank"/></td>     
    </tr> 
    <tr>
     <td style="width:90px ;text-align:right ">联系人:</td>
      <td style="width:180px"><input  name="aae004" class="mini-textbox"  style="width:100%" inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"/></td>
      <td style="width:90px ;text-align:right ">联系电话:</td>
      <td style="width:180px"><input name="aae005"  class="mini-textbox"  style="width:100%" inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"/></td>     
    </tr>    
    <tr>
      <td style="white-space:nowrap ; width:90px ;text-align:right" >社会保障卡号</td>
      <td style=" width:180px" ><input  name="aac001" class="mini-textbox"  style="width:100%" vtype="int;minLength:10" maxlength="10" emptyText="请输入社会保障卡号" required="true" onenter="onKeyEnter2"/></td>
      <td style="white-space:nowrap ; width:90px ;text-align:right">证件号</td>
      <td style=" width:180px"><input name="aac002" class="mini-textbox"  style="width:100%" inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"/></td>
    </tr>
    <tr>
      <td style="white-space:nowrap ; width:90px ;text-align:right">证件类型</td>
      <td style=" width:180px"><input name="aac058"  class="mini-combobox" style="width:100%"  
      inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true" 
      url="${pageContext.request.contextPath }/make.do?method=getaac058&lx=AAC058" textField="aaa103" valueField="aaa102" readonly="readonly"/> </td>
           
      <td style="white-space:nowrap ; width:90px ;text-align:right">姓名</td>
      <td style=" width:180px"><input name="aac003" class="mini-textbox" style="width:100%"  
      inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"/>        
    </tr>
    <tr>
      <td style="white-space:nowrap ; width:90px ;text-align:right" >民族</td>
      <td style=" width:180px"><input name="aac005" class="mini-combobox" style="width:100%" 
       inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"
       url="${pageContext.request.contextPath }/make.do?method=getaac005&lx=AAC005" valueField="aaa102" textField="aaa103" readonly="readonly"/></td>
       <td style="white-space:nowrap ; width:90px ;text-align:right">性别</td>
      <td style=" width:180px"><input name="aac004" class="mini-combobox" style="width:100%"     
      inputStyle="background:rgb(241,241,243)" allowInput="false" readonly="true"
      url="${pageContext.request.contextPath }/make.do?method=getaac004&lx=AAC004" valueField="aaa102" textField="aaa103" readonly="readonly"/></td>
    </tr>
    <tr></tr>  
     <tr></tr>
    <tr>    
      <td colspan="4" height="288px"  style="border:solid 1px #aaa" align="center">
      <div id="pic" align="center" style="height:100%;background-color:rgb(241,241,243);">
          <img height="100%" width="50%" src="" id="img0"/></div></td>           
    </tr>
     <tr>           
      <td colspan="6" height="20px" >&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      &nbsp;&nbsp;&nbsp;&nbsp;
       <a class="mini-button" id="onoks" iconCls="icon-ok" enabled="false"  onclick="onOk" >确认</a>&nbsp;&nbsp;     
      <a class="mini-button"  iconCls="icon-remove" onclick="onReset" >重置</a>&nbsp;&nbsp;  
      <a class="mini-button" id="print"  iconCls="icon-print" enabled="false"  onclick="Preview" >打印</a></td>
    </tr>
  </table>
</div>
</form>
</fieldset>
</div>
<div id="b" class="mini-fit"  >
<div id="datagrid2" class="mini-datagrid"
		style="width:100%; height:100%;"  allowResize="true" frozenStartColumn="0" frozenEndColumn="2" showSummaryRow="true"
		url="" idField="id" allowRowSelect="false" ondrawsummarycell="onDrawSummaryCell">
<div property="columns">
			<div type="indexcolumn" ></div>		
			<div field="aac001" align="center" headerAlign="center" >社会保障卡号</div>
			<div field="aac003"  align="center" headerAlign="center" >姓名</div>
			<div field="aac002"  headerAlign="center" >证件号</div>
			<div field="aaz001" align="center" headerAlign="center" >制卡批次</div>
			<div field="aac058"  headerAlign="center" >证件类型</div>
			<div field="aac004" align="center"  headerAlign="center" >性别</div>
			<div field="aac005" align="center" headerAlign="center" >民族</div>
			<div field="aae011" align="center" headerAlign="center" >操作人</div>	
			<div field="aaz734" align="center" headerAlign="center" summaryType="sum" dataType="currency" currencyUnit="￥" >收费金额</div>			
		   <div field="aae036" align="center" headerAlign="center" dateFormat="yyyy-MM-dd">操作时间</div>
 </div> 
</div>
</div>
<script type="text/javascript">
    mini.parse();     
    var grid = mini.get("datagrid2");              
    var form = new mini.Form("form1");
  function onKeyEnter()
        {
          var aab001 = mini.getbyName("aab001").getValue().trim();  
             if(aab001 == "")
          {
             mini.alert("请输入社会保障卡号");
             return;
          } else{ 
                               
           $.ajax({               
                    url: "/sbk/make.do?method=getunitdata",
                    cache: false,
                    data:{id:aab001},
                    success: function (text) {                 
                        if(text != "null") 
                        {                 
                        var o = mini.decode(text);                                             
                        mini.getbyName("aab004").setValue(o.aab004);
                        mini.getbyName("aae004").setValue(o.aae004); 
                        mini.getbyName("aae005").setValue(o.aae005); 
                        labelModel1();
                        }
                        else
                        {
                           mini.get("onoks").setEnabled(false);
                           mini.alert("无效劳动保障号");
                        }                        
                    }
                    
                });        
        }
         } 
        function onKeyEnter2()
        {
          var aaz001 = mini.getbyName("aaz001").getValue().trim();
          var aac001 = mini.getbyName("aac001").getValue().trim();
          if(aac001 == "")
          {
             mini.alert("请输入社会保障卡号");
             return;
          }
          else{ 
                                
           $.ajax({               
                    url: "/sbk/make.do?method=getunitdata3",
                    cache: false,
                    data:{id:aac001,aaz001:aaz001},
                    success: function (text) { 
                       if("null" == text || "" == text || null == text)
                        {
                          mini.alert("无效社保卡号");
                          return;
                        }
                        var o = mini.decode(text);  
                        if(o.msg == "0") 
                        {                                                                         
                        mini.getbyName("aac002").setValue(o.aac002);                      
                        mini.getbyName("aac058").setValue(o.aac058);
                        mini.getbyName("aac003").setValue(o.aac003);                    
                        mini.getbyName("aac005").setValue(o.aac005);                
                        mini.getbyName("aac004").setValue(o.aac004); 
                        $("#img0").attr("src", "${pageContext.request.contextPath}/Picture/"+aac001+".JPG") ; 
                        mini.get("onoks").setEnabled(true); 
                        labelModel3(); 
                        }
                        else
                        {
                          mini.alert(o.msg);
                          return;
                        }                                           
                    }
                });        
        }
         }
        function onOk(e) {           
           SaveData();                                      	
        }
        
        function SaveData() {
            var aac001 = mini.getbyName("aac001").getValue().trim();      
			var o = form.getData();				
			form.validate();
			if (form.isValid() == false)
			return;
			if(form.isValid()==true){
      	  		mini.mask({el: document.body,cls: 'mini-mask-loading',html: '保存中...'});     	 	
			var json = mini.encode([o]);		
			$.ajax({
				url : "/sbk/make.do?method=saveunithk",
				type : 'post',
				data : {
					data : json,id:aac001
				},
				cache : false,
				success : function(text) {
				    mini.unmask();
				    if("0"== text)
				    {
				     alert("登记成功");
				     labelModel2();
				     mini.get("print").setEnabled(true); 
		             mini.get("onoks").setEnabled(false); 
				    }
				    else
				    {
				      alert("登记失败:"+text);
				      onReset();
				    }					   				
				},
				error : function(jqXHR, textStatus, errorThrown) {
					mini.alert(jqXHR.responseText);					
				}
			});
           
		}	
		}
		   function makePC()
        {                       
         $.ajax({               
                    url: "/sbk/make.do?method=getMakePc",                                     
                    success: function (text) {                                                     
                    mini.getbyName("aaz001").setValue(text);  
                     var key = mini.getbyName("aaz001").getValue().trim();                       
                     grid.setUrl("/sbk/make.do?method=gethkpcunit&key="+ key);
                     grid.load();
                                                                                                                            
                    }
                }); 
              
                      
                                    
        }
        
          function labelModel1() {
            var fields = form.getFields();                          
                var c = fields[0];
                if (c.setReadOnly) c.setReadOnly(true);     //只读
                if (c.setIsValid) c.setIsValid(true);      //去除错误提示
                if (c.addCls) c.addCls("asLabel");          //增加asLabel外观           
        }
        
         function labelModel2() {
            var fields = form.getFields();                           
                var c = fields[3];
                if (c.setReadOnly) c.setReadOnly(true);     //只读
                if (c.setIsValid) c.setIsValid(true);      //去除错误提示
                if (c.addCls) c.addCls("asLabel");          //增加asLabel外观
        }
        
         function labelModel3() {
            var fields = form.getFields();                           
                var c = fields[6];
                if (c.setReadOnly) c.setReadOnly(true);     //只读
                if (c.setIsValid) c.setIsValid(true);      //去除错误提示
                if (c.addCls) c.addCls("asLabel");          //增加asLabel外观
        }
        
         function inputModel1() {
            var fields = form.getFields();           
                var c = fields[0];
                if (c.setReadOnly) c.setReadOnly(false);
                if (c.removeCls) c.removeCls("asLabel");
            mini.repaint(document.body);
              }
              
            function inputModel2() {
            var fields = form.getFields();           
                var c = fields[3];
                if (c.setReadOnly) c.setReadOnly(false);
                if (c.removeCls) c.removeCls("asLabel");
            mini.repaint(document.body);
              }
            function inputModel3() {
            var fields = form.getFields();           
                var c = fields[6];
                if (c.setReadOnly) c.setReadOnly(false);
                if (c.removeCls) c.removeCls("asLabel");
            mini.repaint(document.body);
              }
              
        function onReset(e) {
			form.clear();
			inputModel1();
			inputModel2();
			inputModel3();
			$("#img0").attr("src", "");
			mini.get("print").setEnabled(false); 
		    mini.get("onoks").setEnabled(false); 
			makePC();
		}	
		
		 function onDrawSummaryCell(e) {                        
            if (e.field == "aaz734") {
                e.cellHtml = "应收工本费: " + e.value;
            }
            }	
            
            		 var LODOP; //声明为全局变量 
	function Preview() {	
	CreateTwoFormPage1();	
	  	LODOP.PREVIEW();		
	};
	
	function CreateTwoFormPage1(){
	LODOP=getLodop();
var aac001 = mini.getbyName("aac001").getValue().trim(); 
var aac003 = mini.getbyName("aac003").getValue().trim(); 
var aac004_name = mini.getbyName("aac004").getText().trim(); 
var aac002 = mini.getbyName("aac002").getValue().trim(); 
var aac005 = mini.getbyName("aac005").getText().trim();
LODOP.PRINT_INIT("");
LODOP.ADD_PRINT_TEXT(60,200,100,20,aac001);
LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
LODOP.ADD_PRINT_TEXT(60,470,100,20,aac003);
LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
LODOP.ADD_PRINT_TEXT(60,643,59,20,aac004_name);
LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
LODOP.ADD_PRINT_TEXT(104,158,179,20,aac002);
LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
LODOP.ADD_PRINT_TEXT(104,473,95,25,"");
LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
LODOP.ADD_PRINT_TEXT(104,643,60,20,aac005);
LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
LODOP.ADD_PRINT_TEXT(202,138,494,95,"单位制卡");
LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
LODOP.ADD_PRINT_TEXT(320,138,494,40,"");
LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
LODOP.ADD_PRINT_TEXT(376,138,203,23,"");
LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
LODOP.ADD_PRINT_TEXT(376,535,100,20,"");
LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
}        											
</script>
 </body>
</html>
